﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace WallNaming
{
	public partial class SetSuffixNameForm : System.Windows.Forms.Form
	{
		public SetSuffixNameForm(string oldName, List<string> nameList)
		{
			this.InitializeComponent();
			this.m_OldNameList = nameList;
			this.tbSuffix.Text = oldName;
		}

		public string SuffixName
		{
			get
			{
				return this.tbSuffix.Text;
			}
		}

		private void SetSuffixNameForm_FormClosing(object sender, FormClosingEventArgs e)
		{
			if (((Form)sender).DialogResult == DialogResult.OK)
			{
				foreach (string text in this.m_OldNameList)
				{
					if (text.CompareTo(this.SuffixName) == 0)
					{
						MessageBox.Show("新名称在列表中已经存在。", "盈建科提示");
						e.Cancel = true;
						break;
					}
				}
			}
		}

		private List<string> m_OldNameList = new List<string>();
	}
}
